<html>
<head><meta charset="utf-8"><title>Const Prop for Linting? · t-compiler/wg-mir-opt · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/index.html">t-compiler/wg-mir-opt</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Const.20Prop.20for.20Linting.3F.html">Const Prop for Linting?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="235859164"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Const%20Prop%20for%20Linting%3F/near/235859164" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cameron Steffen <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Const.20Prop.20for.20Linting.3F.html#235859164">(Apr 23 2021 at 15:15)</a>:</h4>
<p>I started down a path of adding <code>tcx.unoptimized_mir</code> for use in Clippy. (<a href="https://github.com/camsteffen/rust/commit/de00aefc1ec7c2e4b620f78d19a29cc1ac5cab54">commit</a>)</p>
<p><span class="user-mention" data-user-id="124288">@oli</span> gave me the following guidance, but I would need some mentorship to do this and he is on parental leave right now.</p>
<blockquote>
<p>Yea that is looking good. Ideally you can keep mir_for_ctfe completely out of metadata and incremental caches and just encode the unoptimized mir. The mir for CTFE query can then just be a thin wrapper around unoptimized mir.</p>
<p>This is a bit problematic due to how const prop works, so your PR lgtm. If you want to fully clean it up, you can change the const prop query to have a flag: either lint or optimize, but never both. Then you can call the linting version in mir_drops_elaborated_and_const_checked and make the one in optimized mir only optimize. After that the unoptimized mir query can stop running const prop, thus allowing you to make the mir for CTFE query just be a function instead of a query</p>
</blockquote>
<p>Would anyone like to help me with this? Also I'm not sure how big of a commitment this is so some estimation there would also be good.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>